<template>
  <div class="home">
    <h2>首页</h2>
    <div>
      当前在线人数：
      <el-tag type="success">{{num}}</el-tag>
    </div>
  </div>
</template>

<script>
export default {
  name: 'home',
  data () {
    return {
      num: 0
    }
  },
  created () {
    this.getOnlineNum()
  },
  mounted () {
  },
  methods: {
    getOnlineNum () {
      this.$api.getOnlineNum(null, data => {
        this.num = data.resource.onlineNumber
      }, err => {
        this.$notify({
          type: 'error',
          message: err.message
        })
      })
    }
  }
}
</script>

<style>

</style>
